package icu.d4peng.cloud.common.auth.properties;

import cn.dev33.satoken.config.SaTokenConfig;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author d4peng
 * @version 1.0.0
 * @date 2021-12-27 09:16
 * @description SaTokenProperties: sa-token配置
 */
@ConfigurationProperties(prefix = SaTokenProperties.PREFIX)
public class SaTokenProperties extends SaTokenConfig implements InitializingBean {
    /**
     * 前缀
     */
    public static final String PREFIX = "roc.token";

    /**
     * 是否开启:默认开启
     */
    private boolean enabled = true;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        this.setIsPrint(false);
    }
}
